{layout name="public/layout" /}
{include file='yxnavbar'}
<style type="text/css">


    .show-image{
        margin: auto;
        height: 260px;/*当图片尺寸不一的时候，设置一个高度*/
        width: 20%;/*三列图片排列*/
    }

    .show-image img {
        position: relative;
        width: 100%;
        top: 50%;
        transform: translateY(-50%);
    }
    .exclusive-image  li{
        list-style: none;
        display: inline-block;
        height: 300px;/*当图片尺寸不一的时候，设置一个高度*/
        width: 18%;/*三列图片排列*/
        /*三列图片排列*/
        text-align: center;
        /*内容居中*/
        overflow: hidden;
        /*超出隐藏*/
        vertical-align: bottom;
        /*内容底部对齐*/
    }
     .content {
        width:90%;
        padding: 5px 0;
        overflow: hidden;
    }

     .img-wrap {
        padding: 10px;
        background-color: #fff;
        border: 1px solid #ccc;
    }

     .img-box {
        height: 215px;
        overflow: hidden;
    }
     .img-box img {
        position: relative;
        width: 100%;
        top: 50%;
        transform: translateY(-50%);
    }
     .title{
        padding-top: 8px;
        font-size: 12px;
        color: #454545;
        height: 25px;
        overflow: hidden;
    }
     .title2{
        font-size: 15px;
        color: #db0c0c;
    }
</style>


<div class="main">
    <ul class="nav nav-tabs">
        <li><a href="{php echo createWebUrl('exclusive_image',array('op'=>'display','themeid'=>$themeid));}">列表</a></li>
        <li class="active"><a href="{php echo createWebUrl('exclusive_image',array('op'=>'audit','themeid' => $themeid));}">审核</a></li>
    </ul>
    <div class="panel panel-default" role="tabpanel">
        <div class="panel-heading">基本信息</div>
        <div class="panel-body">
            <form action="" method="post" class="form-horizontal" role="form" name="form2" id="form2">
                <input type="hidden" name="themeid" value="{$themeid}"/>
                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">专版图片</label>
                    <div class="col-sm-8 col-xs-12">
                        <div class="show-image">
                              <img src="{$item['img_url']}">
                       </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">专版名称</label>
                    <div class="col-sm-8 col-xs-12">
                        <input type="text" class="form-control" placeholder="" disabled name="title" value="{$item['title']}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">秀场公司</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" class="form-control" placeholder="" disabled name="title" value="{$item['company_name']}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">销售人员</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" class="form-control" placeholder="" disabled name="title" value="{$item['salesman_name']}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">设计师</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" class="form-control" placeholder="" disabled name="title" value="{$item['designer_name']}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">相似专版</label>
                    <div class="col-sm-9 col-xs-12 exclusive-image" >
                        <ul id="exclusive_image">
                            {loop  $item['exclusive_image'] $row}
                                <li>
                                    <div class="content">
                                        <div class="img-box">
                                                <img src="{$row['img_url']}"></div>
                                        </div>
                                        <div class="title">{$row['title']}</div>
                                        <div class="title">相似度：<span class="title2">{$row['score']}</span></div>
                                </li>
                            {/loop}
                        </ul>
                    </div>
                </div>

                <div class="form-group" id="sub_upload" >
                    <div class="col-sm-4"></div>
                    <div class="col-sm-6"  style="text-align: center">
                        <input  onclick="pass()" id="btnPass" type="button" value="审核通过" class="btn btn-primary col-lg-2">
                        <input  onclick="reject()" id="btnReject" type="button" value="审核不通过" class="btn btn-warning col-lg-2">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    function pass() {
        let postUrl = "{php echo createWebUrl('exclusive_image',array('op'=>'pass','themeid'=>$themeid));}";
        let success_redirect = "{php echo createWebUrl('exclusive_image',array('op'=>'display','themeid'=>$themeid));}";
        $.ajax({
            url:postUrl,
            dataType:'json',
            method:'post',
            data:{id:{$item[id]}},
            success:function (e) {
                let res = e.result;
                let status = e.status;
                let msg = res.msg;
                if (status!=1){
                    layer.msg(msg)
                }else{
                    layer.msg(msg);
                    window.location.href = success_redirect;
                }
            },
            fail:function (err) {
                console.log(err)
            }
        })
   }

    function reject() {
        layer.confirm('确认审核不通过吗？', {
            btn : [ '确定', '取消' ]//按钮
        }, function(index) {
            let postUrl = "{php echo createWebUrl('exclusive_image',array('op'=>'reject','themeid'=>$themeid));}";
            let success_redirect = "{php echo createWebUrl('exclusive_image',array('op'=>'display','themeid'=>$themeid));}";
            $.ajax({
                url:postUrl,
                dataType:'json',
                method:'post',
                data:{id:{$item[id]}},
                success:function (e) {
                    let res = e.result;
                    let status = e.status;
                    let msg = res.msg;
                    if (status!=1){
                        layer.msg(msg)
                    }else{
                        layer.msg(msg);
                        window.location.href = success_redirect;
                    }
                },
                fail:function (err) {
                    console.log(err)
                }
            })
            layer.close(index);
        });
    }


</script>

